package com.wanchuang.qhbb.view.shop;

import com.chad.library.adapter.base.entity.node.BaseNode;
import com.chad.library.adapter.base.provider.BaseNodeProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.wanchuang.qhbb.R;
import com.wanchuang.qhbb.help.GlideHelper;
import com.wanchuang.qhbb.proto.Mystock;

import org.jetbrains.annotations.NotNull;

public class SecondNodeProvider extends BaseNodeProvider {

    @Override
    public int getItemViewType() {
        return 1;
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_shop;
    }

    @Override
    public void convert(@NotNull BaseViewHolder helper, @NotNull BaseNode data) {
        // 数据类型需要自己强转
        SecondNode entity = (SecondNode) data;
        Mystock.goods item = entity.getGoodsInfo();
        GlideHelper.INSTANCE.loadImage(helper.getView(R.id.iv_logo), item.getGoodsImage());
        helper.setText(R.id.iv_name, item.getGoodsName())
                .setText(R.id.iv_serial, item.getGoodsSerial())
                .setText(R.id.tv_count, item.getNum());
        helper.getView(R.id.rrl_root).setTag(entity);

    }
}
